using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace GoobizFrame.Windows.Controls.TouchscreenKeyboard
{
    public partial class GNumboard : UserControl
    {
        public GNumboard()
        {
            InitializeComponent();

            gKey1.Click += new EventHandler(gKey_Click);
            gKey2.Click += new EventHandler(gKey_Click);
            gKey3.Click += new EventHandler(gKey_Click);
            gKey4.Click += new EventHandler(gKey_Click);
            gKey5.Click += new EventHandler(gKey_Click);
            gKey6.Click += new EventHandler(gKey_Click);
            gKey7.Click += new EventHandler(gKey_Click);
            gKey8.Click += new EventHandler(gKey_Click);
            gKey9.Click += new EventHandler(gKey_Click);
            gKey10.Click += new EventHandler(gKey_Click);
            gKey11.Click += new EventHandler(gKey_Click);
            gKey13.Click += new EventHandler(gKey_Click);
            gKey14.Click += new EventHandler(gKey_Click);
            gKey15.Click += new EventHandler(gKey_Click);
            gKey16.Click += new EventHandler(gKey_Click);
        }

        void gKey_Click(object sender, EventArgs e)
        {
            GKey gKey = (GKey)sender;
            KeyboardEventArgs pKeyboardEventArgs = null;
            string Keypressed = null;
            switch (gKey.Text)
            {
                case ".":
                case "0":
                case "1":
                case "2":
                case "3":
                case "4":
                case "5":
                case "6":
                case "7":
                case "8":
                case "9":
                case "00":
                case "000":
                    Keypressed = gKey.Text;
                    break;
                case "X":
                    Keypressed = "{BACKSPACE}";
                    break;
                case "ENTER":
                    Keypressed = "{ENTER}";
                    break;
            }
            if (Keypressed != null)
            {
                pKeyboardEventArgs = new KeyboardEventArgs(Keypressed);
                OnUserKeyPressed(pKeyboardEventArgs);
            }
        }

        [Category("Mouse"), Description("Return value of mouseclicked key")]
        public event KeyboardDelegate UserKeyPressed;
        protected virtual void OnUserKeyPressed(KeyboardEventArgs e)
        {
            if (UserKeyPressed != null)
                UserKeyPressed(this, e);
        }


       
    }
}
